<%@page import="cn.sendto.model.StudentEntity"%>
<%@page import="cn.sendto.mapper.StudentMapper"%>
<%@page import="cn.sendto.model.CourseEntity"%>
<%@page import="java.util.List"%>
<%@page import="cn.sendto.mapper.CourseMapper"%>
<%@page import="cn.sendto.mapper.IRowMapper"%>
<%@page import="cn.sendto.dbhelper.DBHelper"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="getSession.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta charset="UTF-8">
		<title>添加成绩</title>
		<link rel="stylesheet" type="text/css" href="css/global.css"/>
	</head>
	<style type="text/css">
		body,html{
		with:100%;
		height:100%;
			background-color: #ccc;
			
		}
		.name{
		height:100%;
		margin-top: 10%;
			width: 60%;
			margin: 0 auto;
		}
		.oo{
			margin-top: 30px;
		}
		form{
			text-align: center;
			margin-top: 30px;
		}
		span{
			font-size: 30px;
		}
		input,select{
			font-size: 30px;
			width: 30%;
		}
	</style>
	<body>
		<div class="name">
			<form action="doaddscore.jsp" method="post">
			<%
				request.setCharacterEncoding("utf-8");
				String id = request.getParameter("id");
				DBHelper helper = new DBHelper();
				IRowMapper mapper = new CourseMapper();
				String sql = "select * from courseinfo where  courseid=?";
				
				List<CourseEntity> list = helper.executeQuery(sql, mapper, id);    
				helper.close();
				
				%>	
				<input type="hidden" name="courseid" id="" value="<%=list.get(0).getCourseId() %>" />
				<div class="oo">
					<span >科目：</span>
					<input  name="course" type="text" readonly="readonly" value="<%=list.get(0).getCourseName()%>">
				</div>
					
				<div class="oo">
				<span>姓名：</span><select name="studentid">
				<%
				String sql1 ="select * from studentinfo";
				IRowMapper mapper1 = new StudentMapper();
				List<StudentEntity> list1 = helper.executeQuery(sql1, mapper1, null);
				for(int i=0;i<list1.size();i++){
					out.print("<option value='"+list1.get(i).getStudentId()+"'>"+list1.get(i).getStudentName()+"</option>");
				}			
				%>
						
				</select>				
				</div>
				
				<div class="oo">
					<span>成绩：</span>
					<input type="text" name="score" id="" value="" />
				</div>
				<div class="oo">
				<input type="submit" value="添加" style="width: 80px;"/>
				</div>
			</form>
		
		</div>
	</body>
</html>
